<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var student={
            name:"jack",
            show:function(){
                console.log("我的名字是："+(this.name||"匿名"))
            }
        };
        //1、直接调用
        student.show();
        //2、间接调用
        var stuRef=student.show;  //获取函数的引用
        name="rose";
        stuRef();  //this指向window对象
        //3、使用call指定this
        var obj1={name:"call"};
        student.show.call(obj1); 
        //4、使用apply指定this
        var obj2={name:"apply"};
        student.show.apply(obj2);
    </script>
</body>
</html>